import { http } from '@/utils/http'

export interface IPalmAdviceVo {
  feedbackId: number //主键id
  representativeId: number //人大代表id
  title: string //标题
  content: string //内容
  attachmentFiles: any[] //附件url
  attachmentUrls?: []
  record: string //录音
  submittedAt: string | number //提交时间
  groupId: number | string //提交人职能部门
  submitterName: string //提交人姓名是否匿名
  location: string //位置名字
  detailedLocation: string //位置详情
  longitude: number //经度
  latitude: number //维度
  replyList?: []
  tenantId: number
  status: number
  isAnonymous: number
}
/**
 * 获取掌上建议列表
 */
export const palmAdviceList = (params: any) => {
  return http.get<any>('/wp/feedback/list', params)
}

/**
 * 通过id获取掌上建议
 */
export const palmAdviceById = (feedbackId: number) => {
  return http.get<any>(`/wp/feedback/info/${feedbackId}`)
}

/**
 * 新增掌上建议
 */
export const createPalmAdvice = (params: any) => {
  return http.post<any>('/wp/feedback/add', params)
}

/**
 * 修改掌上建议
 */
export const updatePalmAdvice = (data: any) => {
  return http.put<any>('/wp/feedback/edit', data)
}
/**
 * 删除掌上建议
 */
export const deletePalmAdvice = (data: any) => {
  return http.delete<any>('/wp/feedback/delete', data)
}
/**
 * 获取回复列表
 */
export const replyList = (id: number) => {
  return http.get<any>(`/wp/feedback/getFeedbackResponses?feedbackId=${id}`)
}
// ✅ 可选：统一导出对象
export const palmAdviceApi = {
  list: palmAdviceList,
  getById: palmAdviceById,
  create: createPalmAdvice,
  update: updatePalmAdvice,
  remove: deletePalmAdvice,
  replyList,
}
